﻿@{
    ViewBag.Title = "CustomerAgreementEdit";
}
@model CRM.Admin.Contracts.Dto.Customer.CustomerAgreementDto
@section head
{
    <script src="@Url.Content("~/ScriptPlugin/validate/validate.js")"></script>
    <link href="@Url.Content("~/ScriptPlugin/validate/validate.css")" rel="stylesheet" />
    <script type="text/javascript" src="@Url.Content("~/Scripts/form2json.js")"></script>
    <script type="text/javascript">
    function SaveData(index) {
            if (K.Validate())
            {
                var dto = $('#CustomerAgreementForm').serializeJson();
                K.AjaxJson("@Url.Content("~/Customer/CustomerAgreement/Update")", dto, function (result) {
                    if (K.ShowOrAlert(result)) {
                        parent.K.layer.callback(index, dto);
                        parent.K.layer.close(index);
                    }
                });
            }
    }

    (function ($) {
        $.fn.serializeJson = function () {
            var serializeObj = {};
            $(this.serializeArray()).each(function () {
                serializeObj[this.name] = this.value;
            });
            return serializeObj;
        };
    })(jQuery);
    </script>
}
<form action="" id="CustomerAgreementForm" name="CustomerAgreementForm">
    <div class="content-form">
        <table class="content-table">
            <tr>
                <th><span>品种名称</span></th>
                <td>
                    <input type="hidden" id="CustomerId" name="CustomerId" value="@Model.CustomerId" />
                    <input type="hidden" id="=Id" name="Id" value="@Model.Id"/>
                    <input type="text" data-valid="required" id="ProdName" name="ProdName" value="@Model.ProdName"/>
                </td>
                <th></th>
                <td></td>
            </tr>
            <tr>
                <th>年份</th>
                <td>
                    <select id="Year" name="Year">
                        @for (int i = 2010; i < 2023; i++)
                        {
                            if (i == Model.Year)
                            {
                                <option value="@i" selected="selected">@i</option>
                            }
                            else {
                                <option value="@i">@i</option>
                            }

                        }
                    </select>
                </td>
                <th>
                    月份
                </th>
                <td>
                    <select id="moth" name="moth">
                        @for (int i = 1; i < 13; i++)
                        {
                            if (i == Model.moth)
                            {
                                <option value="@i" selected="selected">@i</option>
                            }
                            else {
                                <option value="@i">@i</option>
                            }

                        }
                    </select>
                </td>
            </tr>
            <tr>
                <th>协议量</th>
                <td>
                    <input type="text" id="ProtocolQuantity" name="ProtocolQuantity" data-rule-number="true" value="@Model.ProtocolQuantity"/>
                </td>
                <th>
                    完成量
                </th>
                <td>
                    <input type="text" id="CompletionQuantity" name="CompletionQuantity" data-rule-number="true" value="@Model.CompletionQuantity"/>
                </td>
            </tr>
        </table>
    </div>
</form>
